//
//  GSection.m
//  helpinrain
//
//  Created by Gang.Wang on 12-7-26.
//  Copyright (c) 2012年 Zhuhai Yuike Technology Co., Ltd. All rights reserved.
//

#import "GSection.h"
#import "GSubSection.h"

@implementation GSection

@synthesize subSection = subSection_;

- (void) dealloc
{
    YRelease(subSection_)
    [super dealloc];
}


- (id) initWithXmlTree:(XMLParsedTree *)tree
{
    self = [super initWithXmlTree:tree];
    if (self) {
        self.name = [self.xmlTree attributeValueOfName:@"name" atPath:@"section"];
        self.description = [self.xmlTree attributeValueOfName:@"description" atPath:@"section"];
        
        NSMutableArray * temp_subsection = [[NSMutableArray alloc] initWithCapacity:3];
        for (XMLParsedTree * node in [self.xmlTree childrenTreeAtPath:@"section" nodeName:@"subsection"]) 
        {
            GSubSection * stepsubSection= [[GSubSection alloc] initWithXmlTree:node];
            [temp_subsection addObject:stepsubSection];
            YRelease(stepsubSection)
        }
        
        self.subSection = temp_subsection;
        YRelease(temp_subsection)
    }
    return self;
}

@end
